<template>
  <div class="app-container">
    <el-form size="small" inline>
      <el-form-item label="土地编码">
        <el-input v-model="query.landCode" placeholder="请输入土地编码" clearable />
      </el-form-item>
      <el-form-item label="提交时间">
        <el-date-picker
          v-model="query.time"
          type="daterange"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
          value-format="yyyy-MM-dd"
        >
        </el-date-picker>
      </el-form-item>
      <el-form-item label="所属地区">
        <el-input v-model="query.region" />
      </el-form-item>
      <el-form-item label="审核状态">
        <el-select v-model="query.state" placeholder="请选择审核状态" clearable>
          <el-option
            v-for="item in dict.type.agriculture_check_state"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          ></el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" @click="getList()">查询 </el-button>
        <el-button plain icon="el-icon-refresh" @click="handleReset()"> 重置 </el-button>
        <help></help>
      </el-form-item>
    </el-form>
    <el-table border v-loading="loading" :data="list">
      <el-table-column align="center" label="经营户类型" prop="type">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.agriculture_manage_type" :value="scope.row.type" />
        </template>
      </el-table-column>
      <el-table-column align="center" label="所属地区" />
      <el-table-column align="center" label="种植物" prop="plant"/>
      <el-table-column align="center" label="申报人" prop="createName"/>
      <el-table-column align="center" label="提交时间" prop="createTime"/>
      <el-table-column align="center" label="种植状态"> </el-table-column>
      <el-table-column align="center" label="审核状态">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.agriculture_check_state" :value="scope.row.state" />
        </template>
      </el-table-column>
      <el-table-column align="center" label="操作">
        <el-button type="text" size="small" icon="el-icon-document">详情</el-button>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
import plantAuditApi from '@/api/production/plant-audit'

export default {
  dicts: ['agriculture_check_state','agriculture_manage_type'],
  data() {
    return {
      loading: false,
      list: [],
      query: {
        landCode: '',
        time: '',
        region: '',
        state: '0',
        pageNum: 1,
        pageSize: 10
      },
      total: 0
    }
  },
  created() {
    this.getList()
  },
  methods: {
    getList() {
      this.loading = true
      plantAuditApi.plantInfoList(this.query).then((res) => {
        this.list = res.rows
        this.total = res.total
        this.loading = false
      })
    },
    handleReset() {
      this.query = {
        landCode: '',
        time: '',
        region: '',
        state: '0',
        pageNum: 1,
        pageSize: 10
      }
      this.getList()
    }
  }
}
</script>

<style></style>
